package homework.hw2;

import java.util.ArrayList;
import java.util.Iterator;

public class QQTest {
    //2.已知数组存放一批QQ号码，QQ号码最长为11位，最短为5位
// String[] strs = {"12345","67891","12347809933","98765432102","67891","12347809933"}。
    //将该数组里面的所有qq号都存放在LinkedList中，将list中重复元素删除，将list中所有元素分别用迭代器和增强for循环打印出来。
    public static void main(String[] args) {
        ArrayList arrayList = new ArrayList();
        String [] strs = {"12345","67891","12347809933","98765432102","67891","12347809933"};
        for (int i = 0; i < strs.length ; i++) {
            arrayList.add( strs[i]);
        }
        arrayList.remove("98765432102");
        arrayList.remove("12347809933");
        arrayList.remove("67891");
        //迭代器遍历
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
        System.out.println("=======================================================================");
        //增强for
        for(Object e : arrayList) {
            System.out.println(e);
        }
    }
}